# Copyright 2019 Google LLC
#
# Licensed under the Apache License, Version 2.0 (the "License");
# you may not use this file except in compliance with the License.
# You may obtain a copy of the License at
#
#     http://www.apache.org/licenses/LICENSE-2.0
#
# Unless required by applicable law or agreed to in writing, software
# distributed under the License is distributed on an "AS IS" BASIS,
# WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied.
# See the License for the specific language governing permissions and
# limitations under the License.

# NOTE: This file is auto generated by the elixir code generator program.
# Do not edit this file manually.

defmodule GoogleApi.Compute.V1.Model.NetworkEndpoint do
  @moduledoc """
  The network endpoint.

  ## Attributes

  *   `annotations` (*type:* `map()`, *default:* `nil`) - Optional metadata defined as annotations on the network endpoint.
  *   `clientDestinationPort` (*type:* `integer()`, *default:* `nil`) - Represents the port number to which PSC consumer sends packets. Optional. Only valid for network endpoint groups created with GCE_VM_IP_PORTMAP endpoint type.
  *   `fqdn` (*type:* `String.t`, *default:* `nil`) - Optional fully qualified domain name of network endpoint. This can only be specified when NetworkEndpointGroup.network_endpoint_type is NON_GCP_FQDN_PORT.
  *   `instance` (*type:* `String.t`, *default:* `nil`) - The name or a URL of VM instance of this network endpoint. Optional, the field presence depends on the network endpoint type. The field is required for network endpoints of type GCE_VM_IP and GCE_VM_IP_PORT. The instance must be in the same zone of network endpoint group (for zonal NEGs) or in the zone within the region of the NEG (for regional NEGs). If the ipAddress is specified, it must belongs to the VM instance. The name must be 1-63 characters long, and comply with RFC1035 or be a valid URL pointing to an existing instance.
  *   `ipAddress` (*type:* `String.t`, *default:* `nil`) - Optional IPv4 address of network endpoint. The IP address must belong to a VM in Compute Engine (either the primary IP or as part of an aliased IP range). If the IP address is not specified, then the primary IP address for the VM instance in the network that the network endpoint group belongs to will be used. This field is redundant and need not be set for network endpoints of type GCE_VM_IP. If set, it must be set to the primary internal IP address of the attached VM instance that matches the subnetwork of the NEG. The primary internal IP address from any NIC of a multi-NIC VM instance can be added to a NEG as long as it matches the NEG subnetwork.
  *   `ipv6Address` (*type:* `String.t`, *default:* `nil`) - Optional IPv6 address of network endpoint.
  *   `port` (*type:* `integer()`, *default:* `nil`) - Optional port number of network endpoint. If not specified, the defaultPort for the network endpoint group will be used. This field can not be set for network endpoints of type GCE_VM_IP.
  """

  use GoogleApi.Gax.ModelBase

  @type t :: %__MODULE__{
          :annotations => map() | nil,
          :clientDestinationPort => integer() | nil,
          :fqdn => String.t() | nil,
          :instance => String.t() | nil,
          :ipAddress => String.t() | nil,
          :ipv6Address => String.t() | nil,
          :port => integer() | nil
        }

  field(:annotations, type: :map)
  field(:clientDestinationPort)
  field(:fqdn)
  field(:instance)
  field(:ipAddress)
  field(:ipv6Address)
  field(:port)
end

defimpl Poison.Decoder, for: GoogleApi.Compute.V1.Model.NetworkEndpoint do
  def decode(value, options) do
    GoogleApi.Compute.V1.Model.NetworkEndpoint.decode(value, options)
  end
end

defimpl Poison.Encoder, for: GoogleApi.Compute.V1.Model.NetworkEndpoint do
  def encode(value, options) do
    GoogleApi.Gax.ModelBase.encode(value, options)
  end
end
